package Bitwise_operatio;

import java.util.HashMap;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:TQ02
 * Data:2024-01-29
 * Time:19:23
 * Text：字符串只出现单个字符
 */
public class Text1 {
    //试图
    public static boolean isUnique2(String astr) {
        int[] array=new int[26];
        char[] arr=astr.toCharArray();
        for(char a:arr){
            int i=(int)a-97;
            if(array[i]==1){
                return false;
            }else{
                array[i]=1;
            }
        }
        return true;
    }
    //hash表
    public static boolean isUnque(String str){
        HashMap<Character,Integer> map=new HashMap<>();
        char[] arr=str.toCharArray();
        for(char a:arr){
            if(map.getOrDefault(a,0)!=0){
               return false;
            }
            map.put(a,1);
        }
        return true;
    }

    public static void main(String[] args) {
       char i=97;
        System.out.println((int)i);
    }
}
